﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MethodArgumentContracts
{
    class Program
    {
        static void Main(string[] args)
        {
            PreventingNull.SingleArgument("hello");
            Console.WriteLine("1) PreventingNull.SingleArgument(\"hello\") passed without throwing exception");

            try
            {
                PreventingNull.SingleArgument(null);
            }
            catch (ArgumentNullException)
            {
                Console.WriteLine("2) PreventingNull.SingleArgument(null) threw System.ArgumentNullException");
            }

            PreventingNull.SingleArgumentAndCustomException("hello");
            Console.WriteLine("3) PreventingNull.SingleArgumentAndCustomException(\"hello\") passed without throwing exception");

            try
            {
                PreventingNull.SingleArgumentAndCustomException(null);
            }
            catch (InvalidOperationException)
            {
                Console.WriteLine("4) PreventingNull.SingleArgumentAndCustomException(null) threw System.InvalidOperationException");
            }

            PreventingNull.CollectionArgument(new string[] { "a", "b", "c", "f" });
            Console.WriteLine("5) PreventingNull.CollectionArgument(new string[] { \"a\", \"b\", \"c\", \"f\" }) passed without throwing exception");

            try
            {
                PreventingNull.CollectionArgument(new string[] { "a", "b", null, "f" });
            }
            catch (ArgumentException)
            {
                Console.WriteLine("6) PreventingNull.CollectionArgument(new string[] { \"a\", \"b\", null, \"f\" }) threw System.ArgumentException");
            }

            PreventingNull.CollectionArgumentAndCustomException(new string[] { "a", "b", "c", "f" });
            Console.WriteLine("7) PreventingNull.CollectionArgumentAndCustomException(new string[] { \"a\", \"b\", \"c\", \"f\" })");

            try
            {
                PreventingNull.CollectionArgumentAndCustomException(new string[] { "a", "b", null, "f" });
            }
            catch (InvalidOperationException)
            {
                Console.WriteLine("8) PreventingNull.CollectionArgumentAndCustomException(new string[] { \"a\", \"b\", null, \"f\" }) threw System.InvalidOperationException");
            }

            BoundaryChecking.SimpleCondition(43.1);
            Console.WriteLine("9) BoundaryChecking.SimpleCondition(43.1) passed without throwing exception");

            try
            {
                BoundaryChecking.SimpleCondition(43.0);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("10) BoundaryChecking.SimpleCondition(43.0) threw System.ArgumentException");
            }

            BoundaryChecking.EqualityCheck(65L);
            Console.WriteLine("11) BoundaryChecking.EqualityCheck(65L) passed without throwing exception");

            try
            {
                BoundaryChecking.EqualityCheck(66L);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("12) BoundaryChecking.EqualityCheck(66L) threw System.ArgumentException");
            }

            UniversalQuantification.SimpleCondition(new double[] { 1.1, 2.0, 0.0 });
            Console.WriteLine("13) UniversalQuantification.SimpleCondition(new double[] { 1.1, 2.0, 0.0 }) passed without throwing exception");

            try
            {
                UniversalQuantification.SimpleCondition(new double[] { 2.2 });
            }
            catch (ArgumentException)
            {
                Console.WriteLine("14) UniversalQuantification.SimpleCondition(new double[] { 2.2 }) threw System.ArgumentException");
            }

            UniversalQuantification.EqualityCheck(new string[] { "a", "b", "c" });
            Console.WriteLine("15) UniversalQuantification.EqualityCheck(new string[] { \"a\", \"b\", \"c\" }) passed without throwing exception");

            try
            {
                UniversalQuantification.EqualityCheck(new string[] { "a", "hey!" });
            }
            catch (ArgumentException)
            {
                Console.WriteLine("16) UniversalQuantification.EqualityCheck(new string[] { \"a\", \"hey!\" }) threw System.ArgumentException");
            }

            ExistentialQuantification.SimpleCondition(new double[] { 7.0, 8.0, 4.0 });
            Console.WriteLine("17) ExistentialQuantification.SimpleCondition(new double[] { 2.0, 3.0, 4.0 }) passed without throwing exception");

            try
            {
                ExistentialQuantification.SimpleCondition(new double[] { 7.0, 8.0, 9.0 });
            }
            catch (ArgumentException)
            {
                Console.WriteLine("18) ExistentialQuantification.SimpleCondition(new double[] { 2.0, 3.0, 5.0 }) threw System.ArgumentException");
            }

            ExistentialQuantification.EqualityCheck(new string[] { "Q", "Q", "z" });
            Console.WriteLine("19) ExistentialQuantification.EqualityCheck(new string[] { \"Q\", \"Q\", \"z\" }) passed without throwing exception");

            try
            {
                ExistentialQuantification.EqualityCheck(new string[] { "Q", "Q", "Q" });
            }
            catch (ArgumentException)
            {
                Console.WriteLine("20) ExistentialQuantification.EqualityCheck(new string[] { \"Q\", \"Q\", \"Q\" }) threw System.ArgumentException");
            }
        }
    }
}
